#debugging (libovolna hodnota), jinak zakomentovat

#ktery soubor pouzivame
EXECUTABLE = tlg
PROCESSORS = 2

SOURCEFILE = $(EXECUTABLE).cpp
CFLAGS = -Wall -pedantic
MPIFLAGS = -n $(PROCESSORS)
EDITOR = vim
#TESTFILE = graf6.txt
#TESTFILE = graf8-7.txt
TESTFILE = graf9-3.txt
#TESTFILE = graf10-5.txt
#TESTFILE = graf11-10.txt
#TESTFILE = graf12-6.txt
#TESTFILE = graf13-6.txt
#TESTFILE = graf14-6.txt
#TESTFILE = graf15-6.txt
#TESTFILE = graf20-8.txt
#TESTFILE = graf30-10.txt
#TESTFILE = graf300-13.txt
TESTLOG = $(subst txt,log,$(TESTFILE))

#CFLAGS += -D DEBUG_INPUT
#CFLAGS += -D DEBUG_DIST
#CFLAGS += -D DEBUG_STACK
#CFLAGS += -D DEBUG_NET
#CFLAGS += -D DEBUG_PERM



all: clean build run

run: $(EXECUTABLE) $(TESTFILE)
	time mpirun $(MPIFLAGS) $(EXECUTABLE) $(TESTFILE) |  tee -a $(TESTLOG)
	echo "=========================" >> $(TESTLOG)

edit: $(SOURCEFILE)
	$(EDITOR) $<

build: $(SOURCEFILE)
	mpic++ $(CFLAGS) -o $(EXECUTABLE) $<

clean:
	rm -f $(EXECUTABLE) *.log
